package yesjava;

//类型参数化
public class Person <T>{ // 泛型的定义
    private String name;
    private T sex;

    public T getSex() {
//        new T();
        Integer[] abc = new Integer[8];
        return sex;
    }

    public Person<T> setSex(T sex) {
        this.sex = sex;
        return this;
    }

    public String getName() {
        return name;
    }

    public Person setName(String name) {
        this.name = name;
        return this;
    }

    public  void fn1(T type){
        System.out.println("不是泛型方法");
    }

    public <E> void fn2(E e){
        System.out.println("泛型方法");
    }
}
